//
//  FileTools.h
//  FrameWork
//
//  Created by Eagle on 5/26/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//


#import <Foundation/Foundation.h>


bool IsPointInRect(CGPoint p, CGRect rect);

//读取CSV文件
void readcsv(const char *filename, char fengei, int item_num, int line_index, char *data_recv, int item_length);


//写文件
class CWriter
{
	NSMutableData* w_data;
public:
	CWriter();
	~CWriter();
public:
	void Close(const char *file_path);
	void WriteInt(int data);
	void WriteFloat(float data);
	void WriteString(const char* str);
	void WriteData(char* data, int size);
};


//读文件
class CReader
{
	NSData* r_data;
	int m_range;
public:
	CReader();
	~CReader();
public:
	bool Open(const char* file_path);
	
	bool OpenResource(const char* file_path);
	void Close();
	
	void ReadInt(int* buf);
	void ReadFloat(float* buf);
	void ReadString(char* str, int buf_length);
	void ReadData(char* data, int size);
};